﻿using FPSO.Models.Constant;
using FPSO.Models.TagMapping;
using Microsoft.Practices.Prism.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FPSO.Models.ViewModel.Controls
{
    public class BarListViewModel : NotificationObject
    {
        private double cFUELOIL;
        private double dOT1;
        private double dOT2;
        private double cDOT;
        private double pWP;
        private double pWS;
        private double tWP;
        private double tWS;
        private double cOOLINGP;
        private double cOOLINGS;
        private double tODT;
        private double dODT;
        private double dOOVERT;
        private double bILGE;
        private double dHOT;
        private double dOT;
        private double sLUDGE;
        private double hYDRORE;
        private double cHYDRO;
        private double eMERFOT;
        private double hELIDT;

		private double cFUELOIL_Volm;
		private double dOT1_Volm;
		private double dOT2_Volm;
		private double cDOT_Volm;
		private double pWP_Volm;
		private double pWS_Volm;
		private double tWP_Volm;
		private double tWS_Volm;
		private double cOOLINGP_Volm;
		private double cOOLINGS_Volm;
		private double tODT_Volm;
		private double dODT_Volm;
		private double dOOVERT_Volm;
		private double bILGE_Volm;
		private double dHOT_Volm;
		private double dOT_Volm;
		private double sLUDGE_Volm;
		private double hYDRORE_Volm;
		private double cHYDRO_Volm;
		private double eMERFOT_Volm;
		private double hELIDT_Volm;
		
		private double cFUELOIL_ratio;
        private double dOT1_ratio;
        private double dOT2_ratio;
        private double cDOT_ratio;
        private double pWP_ratio;
        private double pWS_ratio;
        private double tWP_ratio;
        private double tWS_ratio;
        private double cOOLINGP_ratio;
        private double cOOLINGS_ratio;
        private double tODT_ratio;
        private double dODT_ratio;
        private double dOOVERT_ratio;
        private double bILGE_ratio;
        private double dHOT_ratio;
        private double dOT_ratio;
        private double sLUDGE_ratio;
        private double hYDRORE_ratio;
        private double cHYDRO_ratio;
        private double eMERFOT_ratio;
        private double hELIDT_ratio;

		private double cFUELOIL_barlength;
		private double dOT1_barlength;
		private double dOT2_barlength;
		private double cDOT_barlength;
		private double pWP_barlength;
		private double pWS_barlength;
		private double tWP_barlength;
		private double tWS_barlength;
		private double cOOLINGP_barlength;
		private double cOOLINGS_barlength;
		private double tODT_barlength;
		private double dODT_barlength;
		private double dOOVERT_barlength;
		private double bILGE_barlength;
		private double dHOT_barlength;
		private double dOT_barlength;
		private double sLUDGE_barlength;
		private double hYDRORE_barlength;
		private double cHYDRO_barlength;
		private double eMERFOT_barlength;
		private double hELIDT_barlength;

		private List<double> otherTankInns = new List<double>();
		private List<double> otherTankVols = new List<double>();
        public BarListViewModel()
		{
			otherTankVols.Add(1696.12);//0
			otherTankVols.Add(338.48);
			otherTankVols.Add(225.65);
			otherTankVols.Add(112.83);
			otherTankVols.Add(322.50);
			otherTankVols.Add(322.50); //5
			otherTankVols.Add(316.95);
			otherTankVols.Add(316.95);
			otherTankVols.Add(123.34);
			otherTankVols.Add(123.34);
			otherTankVols.Add(284.87); //10
			otherTankVols.Add(162.30);
			otherTankVols.Add(194.53);
			otherTankVols.Add(324.59);
			otherTankVols.Add(122.578);
			otherTankVols.Add(194.528); //15
			otherTankVols.Add(40.67);
			otherTankVols.Add(30.215);
			otherTankVols.Add(12.086);
			otherTankVols.Add(12.343);
			otherTankVols.Add(2.94); //20

			cFUELOIL = 0;
			dOT1 = 0;
            dOT2 = 0;
            cDOT = 0;
            pWP = 0;
            pWS = 0;
            tWP = 0;
            tWS = 0;
            cOOLINGP = 0;
            cOOLINGS = 0;
            tODT = 0;
            dODT = 0;
            dOOVERT = 0;
            bILGE = 0;
            dHOT = 0;
            dOT = 0;
            sLUDGE = 0;
            hYDRORE = 0;
            cHYDRO = 0;
            eMERFOT = 0;
            hELIDT = 0;

			double default_vol = 0;
			cFUELOIL_Volm = default_vol;
			dOT1_Volm = default_vol;
			dOT2_Volm = default_vol;
			cDOT_Volm = default_vol;
			pWP_Volm = default_vol;
			pWS_Volm = default_vol;
			tWP_Volm = default_vol;
			tWS_Volm = default_vol;
			cOOLINGP_Volm = default_vol;
			cOOLINGS_Volm = default_vol;
			tODT_Volm = default_vol;
			dODT_Volm = default_vol;
			dOOVERT_Volm = default_vol;
			bILGE_Volm = default_vol;
			dHOT_Volm = default_vol;
			dOT_Volm = default_vol;
			sLUDGE_Volm = default_vol;
			hYDRORE_Volm = default_vol;
			cHYDRO_Volm = default_vol;
			eMERFOT_Volm = default_vol;
			hELIDT_Volm = default_vol;
		
			cFUELOIL_ratio = execRatio(cFUELOIL_Volm, 0);
            dOT1_ratio = execRatio(dOT1_Volm, 1);
            dOT2_ratio = execRatio(dOT2_Volm, 2);
            cDOT_ratio = execRatio(cDOT_Volm, 3);
            pWP_ratio = execRatio(pWP_Volm, 4);
            pWS_ratio = execRatio(pWS_Volm, 5);
            tWP_ratio = execRatio(tWP_Volm, 6);
            tWS_ratio = execRatio(tWS_Volm, 7);
            cOOLINGP_ratio = execRatio(cOOLINGP_Volm, 8);
            cOOLINGS_ratio = execRatio(cOOLINGS_Volm, 9);
            tODT_ratio = execRatio(tODT_Volm, 10);
            dODT_ratio = execRatio(dODT_Volm, 11);
            dOOVERT_ratio = execRatio(dOOVERT_Volm, 12);
            bILGE_ratio = execRatio(bILGE_Volm, 13);
            dHOT_ratio = execRatio(dHOT_Volm, 14);
            dOT_ratio = execRatio(dOT_Volm, 15);
            sLUDGE_ratio = execRatio(sLUDGE_Volm, 16);
            hYDRORE_ratio = execRatio(hYDRORE_Volm, 17);
            cHYDRO_ratio = execRatio(cHYDRO_Volm, 18);
            eMERFOT_ratio = execRatio(eMERFOT_Volm, 19);
            hELIDT_ratio = execRatio(hELIDT_Volm, 20);

			cFUELOIL_barlength = cFUELOIL_ratio * 2;
			dOT1_barlength = dOT1_ratio * 2;
			dOT2_barlength = dOT2_ratio * 2;
			cDOT_barlength = cDOT_ratio * 2;
			pWP_barlength = pWP_ratio * 2;
			pWS_barlength = pWS_ratio * 2;
			tWP_barlength = tWP_ratio * 2;
			tWS_barlength = tWS_ratio * 2;
			cOOLINGP_barlength = cOOLINGP_ratio * 2;
			cOOLINGS_barlength = cOOLINGS_ratio * 2;
			tODT_barlength = tODT_ratio * 2;
			dODT_barlength = dODT_ratio * 2;
			dOOVERT_barlength = dOOVERT_ratio * 2;
			bILGE_barlength = bILGE_ratio * 2;
			dHOT_barlength = dHOT_ratio * 2;
			dOT_barlength = dOT_ratio * 2;
			sLUDGE_barlength = sLUDGE_ratio * 2;
			hYDRORE_barlength = hYDRORE_ratio * 2;
			cHYDRO_barlength = cHYDRO_ratio * 2;
			eMERFOT_barlength = eMERFOT_ratio * 2;
			hELIDT_barlength = hELIDT_ratio * 2;

			otherTankInns.Add(4.8);
			otherTankInns.Add(3.9);
			otherTankInns.Add(3.9);
			otherTankInns.Add(3.9);
			otherTankInns.Add(4.75); //5
			otherTankInns.Add(4.75);
			otherTankInns.Add(4.75);
			otherTankInns.Add(4.75);
			otherTankInns.Add(2.55);
			otherTankInns.Add(2.55); //10
			otherTankInns.Add(2.55);
			otherTankInns.Add(2.55);
			otherTankInns.Add(2.55);
			otherTankInns.Add(2.55);
			otherTankInns.Add(2.55); //15
			otherTankInns.Add(2.55);
			otherTankInns.Add(1);
			otherTankInns.Add(4.7);
			otherTankInns.Add(4.7);
			otherTankInns.Add(3.2); //20
			otherTankInns.Add(1);
		}

		public double CFUELOIL_barlength { get { return cFUELOIL_barlength; } set { cFUELOIL_barlength = value; RaisePropertyChanged("CFUELOIL_barlength"); } }
		public double DOT1_barlength { get { return dOT1_barlength; } set { dOT1_barlength = value; RaisePropertyChanged("DOT1_barlength"); } }
		public double DOT2_barlength { get { return dOT2_barlength; } set { dOT2_barlength = value; RaisePropertyChanged("DOT2_barlength"); } }
		public double CDOT_barlength { get { return cDOT_barlength; } set { cDOT_barlength = value; RaisePropertyChanged("CDOT_barlength"); } }
		public double PWP_barlength { get { return pWP_barlength; } set { pWP_barlength = value; RaisePropertyChanged("PWP_barlength"); } }
		public double PWS_barlength { get { return pWS_barlength; } set { pWS_barlength = value; RaisePropertyChanged("PWS_barlength"); } }
		public double TWP_barlength { get { return tWP_barlength; } set { tWP_barlength = value; RaisePropertyChanged("TWP_barlength"); } }
		public double TWS_barlength { get { return tWS_barlength; } set { tWS_barlength = value; RaisePropertyChanged("TWS_barlength"); } }
		public double COOLINGP_barlength { get { return cOOLINGP_barlength; } set { cOOLINGP_barlength = value; RaisePropertyChanged("COOLINGP_barlength"); } }
		public double COOLINGS_barlength { get { return cOOLINGS_barlength; } set { cOOLINGS_barlength = value; RaisePropertyChanged("COOLINGS_barlength"); } }
		public double TODT_barlength { get { return tODT_barlength; } set { tODT_barlength = value; RaisePropertyChanged("TODT_barlength"); } }
		public double DODT_barlength { get { return dODT_barlength; } set { dODT_barlength = value; RaisePropertyChanged("DODT_barlength"); } }
		public double DOOVERT_barlength { get { return dOOVERT_barlength; } set { dOOVERT_barlength = value; RaisePropertyChanged("DOOVERT_barlength"); } }
		public double BILGE_barlength { get { return bILGE_barlength; } set { bILGE_barlength = value; RaisePropertyChanged("BILGE_barlength"); } }
		public double DHOT_barlength { get { return dHOT_barlength; } set { dHOT_barlength = value; RaisePropertyChanged("DHOT_barlength"); } }
		public double DOT_barlength { get { return dOT_barlength; } set { dOT_barlength = value; RaisePropertyChanged("DOT_barlength"); } }
		public double SLUDGE_barlength { get { return sLUDGE_barlength; } set { sLUDGE_barlength = value; RaisePropertyChanged("SLUDGE_barlength"); } }
		public double HYDRORE_barlength { get { return hYDRORE_barlength; } set { hYDRORE_barlength = value; RaisePropertyChanged("HYDRORE_barlength"); } }
		public double CHYDRO_barlength { get { return cHYDRO_barlength; } set { cHYDRO_barlength = value; RaisePropertyChanged("CHYDRO_barlength"); } }
		public double EMERFOT_barlength { get { return eMERFOT_barlength; } set { eMERFOT_barlength = value; RaisePropertyChanged("EMERFOT_barlength"); } }
		public double HELIDT_barlength { get { return hELIDT_barlength; } set { hELIDT_barlength = value; RaisePropertyChanged("HELIDT_barlength"); } }

		[FieldMapper("CFUELOIL.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double CFUELOIL 
		{ 
			get
			{ 
				return cFUELOIL; 
			} 
			set 
			{ 
				cFUELOIL = value;
				RaisePropertyChanged("CFUELOIL"); 
			} 
		}

        [FieldMapper("DOT1.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double DOT1 { get { return dOT1; } set { dOT1 = value; RaisePropertyChanged("DOT1"); } }

        [FieldMapper("DOT2.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double DOT2 { get { return dOT2; } set { dOT2 = value; RaisePropertyChanged("DOT2"); } }

        [FieldMapper("CDOT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double CDOT { get { return cDOT; } set { cDOT = value; RaisePropertyChanged("CDOT"); } }

        [FieldMapper("PWP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double PWP { get { return pWP; } set { pWP = value; RaisePropertyChanged("PWP"); } }

        [FieldMapper("PWS.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double PWS { get { return pWS; } set { pWS = value; RaisePropertyChanged("PWS"); } }

        [FieldMapper("TWP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double TWP { get { return tWP; } set { tWP = value; RaisePropertyChanged("TWP"); } }

        [FieldMapper("TWS.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double TWS { get { return tWS; } set { tWS = value; RaisePropertyChanged("TWS");} }

        [FieldMapper("COOLINGP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double COOLINGP { get { return cOOLINGP; } set { cOOLINGP = value; RaisePropertyChanged("COOLINGP");} }

        [FieldMapper("COOLINGS.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double COOLINGS { get { return cOOLINGS; } set { cOOLINGS = value; RaisePropertyChanged("COOLINGS");} }

        [FieldMapper("TODT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double TODT { get { return tODT; } set { tODT = value; RaisePropertyChanged("TODT");} }

        [FieldMapper("DODT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double DODT { get { return dODT; } set { dODT = value; RaisePropertyChanged("DODT");} }

        [FieldMapper("DOOVERT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double DOOVERT { get { return dOOVERT; } set { dOOVERT = value; RaisePropertyChanged("DOOVERT");} }

        [FieldMapper("BILGE.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double BILGE { get { return bILGE; } set { bILGE = value; RaisePropertyChanged("BILGE");} }

        [FieldMapper("DHOT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double DHOT { get { return dHOT; } set { dHOT = value; RaisePropertyChanged("DHOT");} }

        [FieldMapper("DOT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double DOT { get { return dOT; } set { dOT = value; RaisePropertyChanged("DOT");} }

        [FieldMapper("SLUDGE.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double SLUDGE { get { return sLUDGE; } set { sLUDGE = value; RaisePropertyChanged("SLUDGE"); } }

        [FieldMapper("HYDRORE.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double HYDRORE { get { return hYDRORE; } set { hYDRORE = value; RaisePropertyChanged("HYDRORE"); } }

        [FieldMapper("CHYDRO.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double CHYDRO { get { return cHYDRO; } set { cHYDRO = value; RaisePropertyChanged("CHYDRO"); } }

        [FieldMapper("EMERFOT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double EMERFOT { get { return eMERFOT; } set { eMERFOT = value; RaisePropertyChanged("EMERFOT"); } }

        [FieldMapper("HELIDT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double HELIDT { get { return hELIDT; } set { hELIDT = value; RaisePropertyChanged("HELIDT"); } }

		//其他舱室体积
		[FieldMapper("CFUELOIL.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double CFUELOIL_VOLM
		{
			get
			{
				return cFUELOIL_Volm;
			}
			set
			{
				cFUELOIL_Volm = value;
				RaisePropertyChanged("CFUELOIL_VOLM");
				CFUELOIL_RATIO = execRatio(cFUELOIL_Volm, 0);
				CFUELOIL_barlength = CFUELOIL_RATIO * 2;
			}
		}

		[FieldMapper("DOT1.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DOT1_VOLM
		{
			get
			{
				return dOT1_Volm;
			}
			set
			{
				dOT1_Volm = value;
				RaisePropertyChanged("DOT1_VOLM");
				DOT1_RATIO = execRatio(dOT1_Volm, 1);
				DOT1_barlength = DOT1_RATIO * 2;
			}
		}

		[FieldMapper("DOT2.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DOT2_VOLM
		{
			get
			{
				return dOT2_Volm;
			}
			set
			{
				dOT2_Volm = value;
				RaisePropertyChanged("DOT2_VOLM");
				DOT2_RATIO = execRatio(dOT1_Volm, 2);
				DOT2_barlength = DOT2_RATIO * 2;
			}
		}

		[FieldMapper("CDOT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double CDOT_VOLM
		{
			get
			{
				return cDOT_Volm;
			}
			set
			{
				cDOT_Volm = value;
				RaisePropertyChanged("CDOT_VOLM");
				CDOT_RATIO = execRatio(cDOT_Volm, 3);
				CDOT_barlength = CDOT_RATIO * 2;
			}
		}

		[FieldMapper("PWP.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double PWP_VOLM
		{
			get
			{
				return pWP_Volm;
			}
			set
			{
				pWP_Volm = value;
				RaisePropertyChanged("PWP_VOLM");
				PWP_RATIO = execRatio(pWP_Volm, 4);
				PWP_barlength = PWP_RATIO * 2;
			}
		}

		[FieldMapper("PWS.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double PWS_VOLM
		{
			get
			{
				return pWS_Volm;
			}
			set
			{
				pWS_Volm = value;
				RaisePropertyChanged("PWS_VOLM");
				PWS_RATIO = execRatio(pWS_Volm, 5);
				PWS_barlength = PWS_RATIO * 2;
			}
		}

		[FieldMapper("TWP.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double TWP_VOLM
		{
			get
			{
				return tWP_Volm;
			}
			set
			{
				tWP_Volm = value;
				RaisePropertyChanged("TWP_VOLM");
				TWP_RATIO = execRatio(tWP_Volm, 6);
				TWP_barlength = TWP_RATIO * 2;
			}
		}

		[FieldMapper("TWS.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double TWS_VOLM
		{
			get
			{
				return tWS_Volm;
			}
			set
			{
				tWS_Volm = value;
				RaisePropertyChanged("TWS_VOLM");
				TWS_RATIO = execRatio(tWS_Volm, 7);
				TWS_barlength = TWS_RATIO * 2;
			}
		}

		[FieldMapper("COOLINGP.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double COOLINGP_VOLM
		{
			get
			{
				return cOOLINGP_Volm;
			}
			set
			{
				cOOLINGP_Volm = value;
				RaisePropertyChanged("COOLINGP_VOLM");
				COOLINGP_RATIO = execRatio(cOOLINGP_Volm, 8);
				COOLINGP_barlength = COOLINGP_RATIO * 2;
			}
		}

		[FieldMapper("COOLINGS.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double COOLINGS_VOLM
		{
			get
			{
				return cOOLINGS_Volm;
			}
			set
			{
				cOOLINGS_Volm = value;
				RaisePropertyChanged("COOLINGS_VOLM");
				COOLINGS_RATIO = execRatio(cOOLINGS_Volm, 9);
				COOLINGS_barlength = COOLINGS_RATIO * 2;
			}
		}

		[FieldMapper("TODT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double TODT_VOLM
		{
			get
			{
				return tODT_Volm;
			}
			set
			{
				tODT_Volm = value;
				RaisePropertyChanged("TODT_VOLM");
				TODT_RATIO = execRatio(tODT_Volm, 10);
				TODT_barlength = TODT_RATIO * 2;
			}
		}

		[FieldMapper("DODT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DODT_VOLM
		{
			get
			{
				return dODT_Volm;
			}
			set
			{
				dODT_Volm = value;
				RaisePropertyChanged("DODT_VOLM");
				DODT_RATIO = execRatio(dODT_Volm, 11);
				DODT_barlength = DODT_RATIO * 2;
			}
		}

		[FieldMapper("DOOVERT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DOOVERT_VOLM
		{
			get
			{
				return dOOVERT_Volm;
			}
			set
			{
				dOOVERT_Volm = value;
				RaisePropertyChanged("DOOVERT_VOLM");
				DOOVERT_RATIO = execRatio(dOOVERT_Volm, 12);
				DOOVERT_barlength = DOOVERT_RATIO * 2;
			}
		}

		[FieldMapper("BILGE.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double BILGE_VOLM
		{
			get
			{
				return bILGE_Volm;
			}
			set
			{
				bILGE_Volm = value;
				RaisePropertyChanged("BILGE_VOLM");
				BILGE_RATIO = execRatio(bILGE_Volm, 13);
				BILGE_barlength = BILGE_RATIO * 2;
			}
		}

		[FieldMapper("DHOT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DHOT_VOLM
		{
			get
			{
				return dHOT_Volm;
			}
			set
			{
				dHOT_Volm = value;
				RaisePropertyChanged("DHOT_VOLM");
				DHOT_RATIO = execRatio(dHOT_Volm, 14);
				DHOT_barlength = DHOT_RATIO * 2;
			}
		}

		[FieldMapper("DOT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DOT_VOLM
		{
			get
			{
				return dOT_Volm;
			}
			set
			{
				dOT_Volm = value;
				RaisePropertyChanged("DOT_VOLM");
				DOT_RATIO = execRatio(dOT_Volm, 15);
				DOT_barlength = DOT_RATIO * 2;
			}
		}

		[FieldMapper("SLUDGE.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double SLUDGE_VOLM
		{
			get
			{
				return sLUDGE_Volm;
			}
			set
			{
				sLUDGE_Volm = value;
				RaisePropertyChanged("SLUDGE_VOLM");
				SLUDGE_RATIO = execRatio(sLUDGE_Volm, 16);
				SLUDGE_barlength = SLUDGE_RATIO * 2;
			}
		}

		[FieldMapper("HYDRORE.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double HYDRORE_VOLM
		{
			get
			{
				return hYDRORE_Volm;
			}
			set
			{
				hYDRORE_Volm = value;
				RaisePropertyChanged("HYDRORE_VOLM");
				HYDRORE_RATIO = execRatio(hYDRORE_Volm, 17);
				HYDRORE_barlength = HYDRORE_RATIO * 2;
			}
		}

		[FieldMapper("CHYDRO.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double CHYDRO_VOLM
		{
			get
			{
				return cHYDRO_Volm;
			}
			set
			{
				cHYDRO_Volm = value;
				RaisePropertyChanged("CHYDRO_VOLM");
				CHYDRO_RATIO = execRatio(cHYDRO_Volm, 18);
				CHYDRO_barlength = CHYDRO_RATIO * 2;
			}
		}

		[FieldMapper("EMERFOT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double EMERFOT_VOLM
		{
			get
			{
				return eMERFOT_Volm;
			}
			set
			{
				eMERFOT_Volm = value;
				RaisePropertyChanged("EMERFOT_VOLM");
				EMERFOT_RATIO = execRatio(eMERFOT_Volm, 19);
				EMERFOT_barlength = EMERFOT_RATIO * 2;
			}
		}

		[FieldMapper("HELIDT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double HELIDT_VOLM
		{
			get
			{
				return hELIDT_Volm;
			}
			set
			{
				hELIDT_Volm = value;
				RaisePropertyChanged("HELIDT_VOLM");
				HELIDT_RATIO = execRatio(hELIDT_Volm, 20);
				HELIDT_barlength = HELIDT_RATIO * 2;
			}
		}
		/// <summary>
		/// /////////////////////////////////////////////////////
		/// </summary>

		public double CFUELOIL_RATIO { get { return cFUELOIL_ratio; } set { cFUELOIL_ratio = value; RaisePropertyChanged("CFUELOIL_RATIO"); } }


        public double DOT1_RATIO { get { return dOT1_ratio; } set { dOT1_ratio = value; RaisePropertyChanged("DOT1_RATIO"); } }


        public double DOT2_RATIO { get { return dOT2_ratio; } set { dOT2_ratio = value; RaisePropertyChanged("DOT2_RATIO"); } }


        public double CDOT_RATIO { get { return cDOT_ratio; } set { cDOT_ratio = value; RaisePropertyChanged("CDOT_RATIO"); } }


        public double PWP_RATIO { get { return pWP_ratio; } set { pWP_ratio = value; RaisePropertyChanged("PWP_RATIO"); } }


        public double PWS_RATIO { get { return pWS_ratio; } set { pWS_ratio = value; RaisePropertyChanged("PWS_RATIO"); } }


        public double TWP_RATIO { get { return tWP_ratio; } set { tWP_ratio = value; RaisePropertyChanged("TWP_RATIO"); } }


        public double TWS_RATIO { get { return tWS_ratio; } set { tWS_ratio = value; RaisePropertyChanged("TWS_RATIO"); } }


        public double COOLINGP_RATIO { get { return cOOLINGP_ratio; } set { cOOLINGP_ratio = value; RaisePropertyChanged("COOLINGP_RATIO"); } }


        public double COOLINGS_RATIO { get { return cOOLINGS_ratio; } set { cOOLINGS_ratio = value; RaisePropertyChanged("COOLINGS_RATIO"); } }


        public double TODT_RATIO { get { return tODT_ratio; } set { tODT_ratio = value; RaisePropertyChanged("TODT_RATIO"); } }


        public double DODT_RATIO { get { return dODT_ratio; } set { dODT_ratio = value; RaisePropertyChanged("DODT_RATIO"); } }


        public double DOOVERT_RATIO { get { return dOOVERT_ratio; } set { dOOVERT_ratio = value; RaisePropertyChanged("DOOVERT_RATIO"); } }


        public double BILGE_RATIO { get { return bILGE_ratio; } set { bILGE_ratio = value; RaisePropertyChanged("BILGE_RATIO"); } }


        public double DHOT_RATIO { get { return dHOT_ratio; } set { dHOT_ratio = value; RaisePropertyChanged("DHOT_RATIO"); } }


        public double DOT_RATIO { get { return dOT_ratio; } set { dOT_ratio = value; RaisePropertyChanged("DOT_RATIO"); } }


        public double SLUDGE_RATIO { get { return sLUDGE_ratio; } set { sLUDGE_ratio = value; RaisePropertyChanged("SLUDGE_RATIO"); } }


        public double HYDRORE_RATIO { get { return hYDRORE_ratio; } set { hYDRORE_ratio = value; RaisePropertyChanged("HYDRORE_RATIO"); } }


        public double CHYDRO_RATIO { get { return cHYDRO_ratio; } set { cHYDRO_ratio = value; RaisePropertyChanged("CHYDRO_RATIO"); } }


        public double EMERFOT_RATIO { get { return eMERFOT_ratio; } set { eMERFOT_ratio = value; RaisePropertyChanged("EMERFOT_RATIO"); } }


        public double HELIDT_RATIO { get { return hELIDT_ratio; } set { hELIDT_ratio = value; RaisePropertyChanged("HELIDT_RATIO"); } }

		private double execRatio(double val, int pos)
		{
			int total_height = 100;

			//int rtn = Convert.ToInt32(val * TankConstant.TANKLEVEL_PARAM / otherTankInns[pos] * total_height);
			double rtn = Convert.ToDouble(val / otherTankVols[pos] * total_height);
			if (rtn > 100)
				rtn = 100;
			return rtn;
		}
	}
}
